<?php

if (isset($_POST['submit_invest']))
{
	$an = stripslashes(@$_POST['title']);

	$a_fc = stripslashes(@$_POST['fontcolor']);
	$a_fn = stripslashes(@$_POST['fontname']);
	$a_fa = '0';//stripslashes(@$_POST['fontangle']);
	$a_fs = stripslashes(@$_POST['fontsize']);

	$a_ol = stripslashes(@$_POST['t_offl']);
	$a_ot = stripslashes(@$_POST['t_offt']);
	$a_bw = stripslashes(@$_POST['t_boxw']);
	$a_if = @$_FILES['imageurl']['name'];
	$a_ift = @$_FILES['imageurl']['tmp_name'];

	@session_start();
	$access_token = $_SESSION['access_token'];
	
	$suser = $access_token['user_id'];

	//need to write to client's file
	$topdir = "/home/boostpo1/public_html/chirplace.com/usr/".$suser."/images/".$an.".php";
	$fh = fopen($topdir, 'w');
	fwrite($fh, "<?php\n\r\$defaultcolor = '$a_fc';\n\r\$defaultfont = '$a_fn';\n\r\$defaultangle = '0';\n\r\$defaultsize = '$a_fs';\n\r\$pathinfo = array(array(\$defaultsize, \$defaultangle, '$a_ol,$a_bw', $a_ot, \$defaultcolor, \$defaultfont),);\n\r?>");
	fclose($fh);
	
	
	$topdir = "/home/boostpo1/public_html/chirplace.com/usr/".$suser."/images/".$an.".jpg";
	$img = imagecreatefromstring(file_get_contents($a_ift));
	
	imagejpeg($img, $topdir);
	imagedestroy($img);
}

header("Location:index.php?start=visualine");
?>